<!--
 * @Author: your name
 * @Date: 2021-09-06 12:12:20
 * @LastEditTime: 2021-09-07 09:12:06
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\5-javascript\day11\6-Comment.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="app">
        <!-- 这是注释 -->
    </div>
</body>
<script>
    //拿到注释节点
    var commentNode = document.getElementsByClassName("app")[0].firstChild.nextSibling;
    console.log(commentNode); //<!-- 这是注释 -->
    console.log(commentNode.nodeName); //#comment
    console.log(commentNode.nodeType); //8
    //创建注释节点
    var commentNode = document.createComment("这是一个注释");
    console.log(commentNode); //<!-- 这是注释 -->
</script>

</html>